<template>
	<view class="con">
		<!-- 自定义导航栏 -->
		<deary-cate-list :activeIndex="activeIndex" :lists="lists" @click="cateClick"></deary-cate-list>
	</view>
</template>

<script>
import httpApi from '../../../http';
export default {
	onLoad(e) {
		console.log(e.type);
		this.activeIndex = e.type;
		this.init();
	},
	data() {
		return {
			activeIndex: 0,
			// 列表数据 title:标题 shop:展示列表
			lists: [
				{
					title: '能量门',
					list: [
						{
							title: '能量门内容一',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '能量门内容二',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '能量门内容三',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '能量门内容四',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						}
					]
				},
				{
					title: '命运之轮',
					list: [
						{
							title: '命运之轮内容一',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '命运之轮内容二',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '命运之轮内容三',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '命运之轮内容四',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						}
					]
				},
				{
					title: '高级定制',
					list: [
						{
							title: '高级定制内容一',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '高级定制内容二',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '高级定制内容三',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						},
						{
							title: '高级定制内容四',
							image: 'https://ask.dcloud.net.cn/uploads/avatar/001/71/93/72_avatar_max.jpg'
						}
					]
				}
			]
		};
	},
	methods: {
		init() {
			httpApi.MallApi.getGoodsList({}).then((res) => {
				// for (let item of res.data) {
				// 	for (let good of item.goods) {
				// 		good.image = this.$url + good.image;
				// 	}
				// }
				this.lists = res.data;
			});
		},
		cateClick(item) {
			console.log('当前点击', item);
			uni.navigateTo({
				url: '/pages/mall/productDetails/productDetails?id=' + item.id,
				success: (res) => {},
				fail: () => {},
				complete: () => {}
			});
		}
	}
};
</script>

<style lang="scss" scoped></style>
